package com.javaee.util;
import java.io.BufferedReader;  
import java.io.IOException;  
import java.io.InputStream;  
import java.io.InputStreamReader;  
import java.io.UnsupportedEncodingException; 
public class Utils {

	public static String convertStreamToString(InputStream in) throws UnsupportedEncodingException {    
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));    
        BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));  
        StringBuilder sb = new StringBuilder();    
        String line = null;    
        try {    
            while ((line = reader.readLine()) !=null ) {    
                sb.append(line + "/n");    
            }    
        } catch (IOException e) {    
            e.printStackTrace();    
        } finally {    
            try {    
                in.close();    
            } catch (IOException e) {    
                e.printStackTrace();    
            }    
        }    
        return sb.toString();    
    }    
}
